 package com.oanda.blackberry.ui;
 
 import net.rim.device.api.system.Application;
 import net.rim.device.api.system.Display;
 import net.rim.device.api.ui.Field;
 import net.rim.device.api.ui.Screen;
 import net.rim.device.api.ui.UiApplication;
 import net.rim.device.api.ui.container.FullScreen;
 import net.rim.device.api.ui.container.MainScreen;
 
 public class TransitionMainScreen extends MainScreen
 {
   int w = Display.getWidth();
   int h = Display.getHeight();
 
   private int initialStart = 270;
   public int HorizontalOffset = this.w;
   private static final long animationTime = 150L;
   public long animationStart = 0L;
 
   protected void sublayout(int width, int height) { super.sublayout(width, height);
 
     if (this.HorizontalOffset > 0) {
       if (this.animationStart == 0L)
       {
         this.animationStart = System.currentTimeMillis();
       }
       else {
         long timeElapsed = System.currentTimeMillis() - this.animationStart;
         if (timeElapsed >= 150L) {
           this.HorizontalOffset = 0;
         }
         else {
           float percentDone = (float)timeElapsed / 150.0F;
           this.HorizontalOffset = (this.w - this.initialStart - (int)(percentDone * this.w - this.initialStart));
         }
       }
     }
     setPosition(this.HorizontalOffset, 0);
     if (this.HorizontalOffset > 0)
       UiApplication.getUiApplication().invokeLater(new Runnable() {
         public void run() {
           TransitionMainScreen.this.updateLayout();
         }
       });
   }
 
   public boolean onClose()
   {
     this.animationStart = 0L;
     return super.onClose();
   }
 
   public boolean onSavePrompt() {
     return true;
   }
}

